package com.enze.encryptionanddecryption.demo;

import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author TacoMan
 * @Date 2023/6/12 15:26
 * @Version 1.0
 */
public class demo {
    public static void main(String[] args) {
/*        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");


        long timeNow= System.currentTimeMillis();
        long timeLose=System.currentTimeMillis()+2*60*60*1000;

        System.out.println(timeNow+"  "+timeLose);


        String dateNow=sdf.format(new Date(timeNow));
        String loseDate=sdf.format(new Date(timeLose));

        System.out.println("申请全局access_token时间="+dateNow+"    全局access_token失效时间为="+loseDate);
        ArrayList<Object> list = new ArrayList<>();
        LocalDate today = LocalDate.now();
        int monthValue = today.getMonthValue();
        System.out.println(monthValue);
        System.out.println(today.getDayOfMonth());
        System.out.println(today.getDayOfYear());
        System.out.println(today.getYear());
        System.out.println(today.getYear()+"年"+today.getMonthValue()+"月");

        ArrayList list1 = new ArrayList<>();
        list1.add("xiaoming");
        list1.add("xiaohong");
        list1.add("xiaogong");
        list1.add("xiaohei");
        user user1 = new user();
        user1.setList(list1);
        user1.setId("1");
        ArrayList<user> users = new ArrayList<>();
        users.add(user1);
        List<user> xiaoming = users.stream().filter(d -> d.getList().contains("xiaoming")).collect(Collectors.toList());
        for (user user : xiaoming) {
            System.out.println(user.getId()+"::"+user.getList());
        }
        long timeMillis = System.currentTimeMillis();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        System.out.println(dateFormat.format(timeMillis));
        LocalDate date1 = LocalDate.of(2023, 5, 18);
        LocalDate date2 = LocalDate.of(2023, 5, 10);

        LocalDate dateParam = LocalDate.parse("2024-09-03", df);
        LocalDate parse = LocalDate.parse("2025-09-03");
        System.out.println("parse："+parse);
        System.out.println(dateParam);
        // 计算两个日期之间的天数
        long daysBetween = ChronoUnit.DAYS.between(date1, date2);
        System.out.println("相差天数: " + daysBetween);*/
        String str="辽交督办〔2023〕001号";
        int length = str.length();
        String numStr = str.substring(10, length-1);
        System.out.println(numStr);
        int num = Integer.parseInt(numStr);
        String numStrFormat = String.format("%03d", num);

        System.out.println(numStrFormat);
        System.out.println(LocalDate.now());
    }
}
